package org.wms;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.wms.pojo.Appointment;
import org.wms.service.AppointmentService;

/**
 * @author : 阿盛哟
 * @description :对MySQL数据库的功能测试
 * @createDate : 2025/4/30 22:19
 */
@SpringBootTest
class AppointmentServiceTest {
    @Autowired
    private AppointmentService  appointmentService;
    /**
     * 测试查询信息
     */
    @Test
    void testGetOne() {
        Appointment appointment = new Appointment();
        appointment.setUsername("张三");
        appointment.setIdCard("123456789012345678");
        appointment.setDepartment("内科");
        appointment.setDate("2025-04-14");
        appointment.setTime("上午");

        Appointment appointmentDB = appointmentService.getOne(appointment);
        System.out.println(appointmentDB);
    }
    /**
     * 测试预约添加信息
     */
    @Test
    void testSave() {
        Appointment appointment = new Appointment();
        appointment.setUsername("张三");
        appointment.setIdCard("123456789012345678");
        appointment.setDepartment("内科");
        appointment.setDate("2025-04-14");
        appointment.setTime("上午");
        appointment.setDoctorName("张医生");

        appointmentService.save(appointment);
    }

    /**
     * 测试删除信息
     */
    @Test
    void testRemoveById() {
        appointmentService.removeById(1L);
    }
}